Repository navigation
Conversation
Coverage
|
pcarrier
force-pushed
the
keep-output
branch
from
September 30, 2026 09:17
fabc391 to
763661d
Compare
…run#86) * Report a spawned process's exit unasked: bash in one round trip A SPAWN with the new opt-in flag REPORT_EXIT (16) gets its process's exit as an EXIT Event (Process 0x0002, sensitive) once it is final: the record a WAIT would return then. A command's SPAWN Result, output and exit thus all come from one request, where a client had to send WAIT and wait a round trip more. - Servers advertise it in a new optional family limit, LAUNCHER_FLAGS_EXTENDED (tag 19), since clients from before accept at most 12 in tag 11; a client sets REPORT_EXIT only when tag 19 offers it, so either side may be older. - The report takes none of the session's pending WAITs, is sent once (a SPAWN retried under its operation ID shares it), and outlives the streams: when the spawning session's attachment goes before the exit (its streams dropped, their route failed), the server waits for the exit itself and still sends it. - The streams go on at the pace of their credit, so the EXIT may arrive before their last bytes and CLOSE. - yas-client sets the flag whenever offered; Process::wait/wait_timeout then take no request and keep the reported exit. Attached processes, and servers without the flag, still WAIT. Tests (client_host): a_spawned_process_reports_its_exit_without_a_wait (with the only WAIT held, a non-zero exit with stderr, output beyond the stream buffer read while the exit is awaited, a signal, and another session's attachment that still WAITs), and a_server_from_before_report_exit_is_waited_for (ignored; YAS_OLD_SERVER=<yas without the flag>). * Report an exit only from the attachment that saw it; WAIT once that goes Review of yas-run#86: the server's fallback wait, for a REPORT_EXIT process whose attachment went before its exit, bound the process again (a detached one's slot was taken back and ATTACH answered CONFLICT), hung Process::wait when that wait failed, and an attachment aborted mid-send lost the EXIT. The fallback is gone: the attachment reports the exit, from a task of its own so removing the attachment meanwhile cannot cut the EXIT short. When the attachment goes first (a Transfer RESET on any of its streams, stdin included, sent or received, or a DETACH) no EXIT comes, and yas-client knows: its router marks the process's report lost, and Process::wait and wait_timeout then WAIT, after taking an EXIT that already arrived. * Make tag 19 a set of SPAWN flags whose unknown bits clients ignore LAUNCHER_FLAGS_EXTENDED's hard maximum was 28, the flags it carries today: a later server adding one would have failed the HELLO of every client from this PR, as tag 11's maximum of 12 would have failed older clients for REPORT_EXIT. Its hard maximum is now 65535 (any u16 of SPAWN flags) and Limits::from_extensions keeps only the flags it knows, so the next flag needs no new tag.
SPAWN_KEEP_OUTPUT (32), with REPORT_EXIT and SPAWN extension tag 4 [head_bytes, tail_bytes] (the tail at most 1 MiB), sends only the head and the tail of each output stream. What comes between is dropped as the server reads it, never held for the client's credit, so a command writing far more than its client keeps runs at the speed of its pipe instead of one window per round trip. The cuts fall between characters as a WHATWG UTF-8 decoder with replacement reads the whole stream (a JavaScript TextDecoder, Rust's from_utf8_lossy), so decoding the head and the tail gives exactly the characters they have within it. The EXIT event says what was dropped of each stream (extension tags 1 and 2, OutputElision: offset, bytes, lines, code points, UTF-16 units), so a client can say how much it did not get in the units it counts. The output reader waits for the owner only while the head goes out, keeps the last tail_bytes in a ring, and sends them at the stream's end, or before the exit is reported when the stream outlives it (a residue past its grace, TERMINATE, a lost owner, a forced cleanup): flush_kept. yas-client: Command::keep_output(head, tail), set where the server offers it; Process::elided(stderr) once the exit came.
Review of yas-run#88: Output had no place for what KEEP_OUTPUT dropped, and output() takes the process, so a kept command's head and tail came joined with nothing to say a middle was missing. Output.elided now carries it (the test's helper is output_limited again). And the new mod output_keep line took mod process's #[cfg(any(unix, windows))].
protocol-fuzz found OutputElision::decode multiplying a decoded code point count by two, which panics past u64::MAX / 2. Saturate instead: a count that wide bounds nothing it could hold. Test the five counts' rules, prefixes, and the widest values.
pcarrier
force-pushed
the
keep-output
branch
from
September 30, 2026 09:22
763661d to
3c38bb3
Compare
Author
|
Upstream PR merged into yas-run/yas main (now dd33f04): this CI-only draft is done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fork CI for yas-run#88 (yas-run Actions are stuck org-wide).